from fastapi.params import Depends

from lib.dependency.dependencies import check_admin_access
from main import app
from .. import plugin_config
from ..admin.admin_router import admin_router
from ..plugin_config import module_name



def register_admin_router():
    """在管理员中注册插件管理器菜单.

    Examples:
        经理是 Depends(check_admin_access) 您需要添加依赖项以保护您的访问权限.
        manager路由器的 prefix 不是空白。. 默认值为 /admin 就这样..
    """
    app.include_router(admin_router, prefix="/admin", tags=[module_name], dependencies=[Depends(check_admin_access)], include_in_schema=False)


def register_admin_menu():
    """管理器菜单注册
    plugin_config.py 在管理员菜单中设置
    Returns:
        dict: 管理器菜单
    """
    return getattr(plugin_config, "admin_menu", {})
